<h2><a href="<?=site_url('company/'.$company->company_name);?>"><?=$company->company_name;?></a> &ndash; <?=$job->job_title;?></h2>

<input type="hidden" name="jobid" id="jobid" value="<?=$job->id;?>" />
<input type="hidden" name="companyid" id="companyid" value="<?=$company->id;?>" />

<div class="block tabs spaces">
	<div class="hd">	
		<ul>
			<li><a href="<?=site_url('company/'.$company->company_name.'/'.$job->job_title.'/updates');?>">Updates</a></li>
			<li><a>Milestones</a></li>
			<li><a href="<?=site_url('company/'.$company->company_name.'/'.$job->job_title.'/costs');?>">Costs</a></li>
		<?php if ($permissions->createinvoice):?><li><a href="<?=site_url('company/'.$company->company_name.'/'.$job->job_title.'/billing');?>">Billing</a></li><?php endif;?>
			<li><a href="<?=site_url('company/'.$company->company_name.'/'.$job->job_title.'/setup');?>">Job Setup</a></li>
		</ul>
		<div class="clear"></div>
	</div>

	<div class="bd">
	
	<h2>Milestones</h2>
	
		<?php if ($activities):?>
			<ul class="milestones clearfix">
			<?php foreach($activities as $row => $activity):?>
				<li class="milestone <?php if ($activity->completion):?>complete<?php endif;?> clearfix">
					
					<a href="<?=site_url('jobs/deleteActivity/'.$activity->id);?>" class="delete">Delete</a>

					<?php if ($activity->centertitle):?>
					<p class="responsable"><?=$activity->centertitle;?></p>
					<?php endif;?>

					<p class="dates"><?php if($activity->enddate) echo 'Ends: '.date("d/m/Y", strtotime($activity->enddate)); ?></p>
				
					<h4><?php if ($activity->completion):?>
					<label><input class="notcomplete milestonecheck" type="checkbox" checked="checked" /></label>
					<?php else:?>
					<label><input class="complete milestonecheck" type="checkbox" /></label>
					<?php endif;?> <?=$activity->activity_title;?></h4>
				</li>
			<?php endforeach;?>
			</ul>
		<?php elseif (!$permissions->addtasks):?>
			<p>Add the first task for this Job</p>
		<?php endif;?>

</div>
</div></div></div></div>

<div id="sidebar" class="yui-b">
	
<div class="block">
	<div class="hd">
		<h3>Add a New Milestone</h3>
	</div>
	<div class="bd">
	<?php if ($permissions->addtasks):?>
	
		<?=form_open('jobs/addActivity', array('class' => 'addmilestone'));?>

		<fieldset>
			<p>
				<label class="title">Milestone</label>
				<input class="text" type="text" name="activity_title" id="activity_title" />
			</p>
		
			<p>
				<label>Department</label>
				
				<?php if($costcenters):?>
					<select class="text" class="narrow" name="department">
						<option value="0">None</option>
						<?php foreach ($costcenters as $center):?>
						<option value="<?=$center->id;?>"><?=$center->centertitle;?></option>
						<?php endforeach;?>
					</select>
				<?php endif;?>
			</p>
			
			<p>
				<label>Starts</span></label>
				<input class="text" type="text" name="startdate" value="<?=date('d/m/Y');?>" />
			</p>
			
			<p>
				<label>Due</label>
				<input class="text" type="text" name="enddate" />
			</p>
		</fieldset>

		<input type="hidden" class="hidden" name="jobid" value="<?=$job->id;?>" />
		
		<p><input type="submit" class="submit" value="Save Milestone" /></p>

		<?=form_close();?>
	<?php endif;?>
	</div>
</div>
